<!-- 
 Copyright 2009 University of  Washington
This code is released under the GPL version 3 - with a copy of the license included
@author Maya Hao Li
 -->

<%
// prints user information. if a user oid is given, print the user's info. 
// otherwise print a list of users.
LimsSession spsession = new LimsSession(request);

	String oidStr = request.getParameter("userOid");
	if (oidStr != null && oidStr.length() > 0) {
		Integer oid = Integer.parseInt(oidStr);
		SeedpodUser user = new SeedpodUser(oid, spsession
				.getDataManager());
		InstanceRenderer viewer = new InstanceRenderer(user);
		out.println(viewer.renderInstance());
	} else {
		out.println("<a href=\"#\" class=\"menuItemLink\">+Add a user</a>");
		System.out.println("user.jsp : user class = " + SeedpodModel.RdbCls.USER );
		DataObjectSet userSet = new DataObjectSet(
				SeedpodModel.RdbCls.USER, spsession.getDataManager());
		ArrayList<SeedpodDO> users = userSet.query(null);
		if (users.size() > 0) {
			out
					.println("<ul type=\"square\" style=\"text-indent: -3em; list-style-position:inside;\">");
			for (SeedpodDO obj : users) {
				SeedpodUser u = (SeedpodUser) obj;
				out.println("<LI><a href=instance.jsp?oid="+u.getOid()+"&clsName=" +SeedpodModel.RdbCls.USER+">" + u.getLabel() + "</li>");
			}
			out.println("</ul>");
		}
	}
%>
<%@page import="seedpod.model.*"%>
<%@page import="seedpod.model.DataObjectSet"%>
<%@page import="seedpod.model.SeedpodModel"%>
<%@page import="seedpod.webapp.LimsSession"%>
<%@page import="java.util.ArrayList"%>
<%@page
	import="seedpod.model.custom.SeedpodUser"%>

<%@page
	import="seedpod.webapp.view.InstanceRenderer"%>
